#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let client = reqwest::Client::builder().build()?;

    let mut headers = reqwest::header::HeaderMap::new();
    headers.insert(
        "Authorization",
        "Bearer sk-C5bEx2i4TdgjLlYmj921sTv75PiEz93G8tvTLIGebA0jg2E5".parse()?,
    );
    headers.insert("Content-Type", "application/json".parse()?);
    headers.insert("Connection", "keep-alive".parse()?);

    let data = r#"{
    "model": "gpt-4o-mini",
    "messages": [
        {
            "role": "user",
            "content": "Here is a task description for which I would like you to create a high-quality prompt template for:\n<task_description>\n从长篇报告中提取洞察、识别风险并提炼关键信息\n</task_description>\nBased on task description, please create a well-structured prompt template that another AI could use to consistently complete the task. The prompt template should include:\n- Do not include <input> or <output> section and variables in the prompt, assume user will add them at their own will. \n- Clear instructions for the AI that will be using this prompt, demarcated with <instructions> tags. The instructions should provide step-by-step directions on how to complete the task using the input variables. Also Specifies in the instructions that the output should not contain any xml tag. \n- Relevant examples if needed to clarify the task further, demarcated with <example> tags. Do not include variables in the prompt. Give three pairs of input and output examples.   \n- Include other relevant sections demarcated with appropriate XML tags like <examples>, <instructions>.\n- Use the same language as task description. \n- Output in ``` xml ``` and start with <instruction>\nPlease generate the full prompt template with at least 300 words and output only the prompt template."
        }
    ]
}"#;

    let json: serde_json::Value = serde_json::from_str(&data)?;

    let request = client
        .request(
            reqwest::Method::POST,
            "https://api.bianxie.ai/v1/chat/completions",
        )
        .headers(headers)
        .json(&json);

    let response = request.send().await?;
    let body = response.text().await?;

    println!("{}", body);

    Ok(())
}
